Use Case 2: Combine different data on a map


In [1]:
# Needed in IPython notebook only
from IPython.display import Image   
%matplotlib inline

In [2]:
!wget -P data -nc http://nomads.ncdc.noaa.gov/data/gfs4/201910/20191001/gfs_4_20191001_0000_000.grb2


File ‘data/gfs_4_20191001_0000_000.grb2’ already there; not retrieving.


In [ ]:
d = Domain('+proj=longlat', '-te -10 55 20 75 -tr 0.1 0.1')
n.reproject(d)

u = n['U']
v = n['V']
w = np.hypot(u,v)

# create canvas to draw a map
nmap = Nansatmap(n, resolution='l')

# make plot of wind speed (color) and add colorbar
nmap.pcolormesh(w)
nmap.add_colorbar(fontsize=10)

# add vectors showing wind directions
nmap.quiver(u, v, step=10)

# add continents on top
nmap.draw_continents()

# draw grid of parallels and meridians
# at given locations
nmap.drawparallels([65, 70, 75], labels=[1,0,0,0])
nmap.drawmeridians([5, 10, 15, 20, 25], labels=[0,0,1,0])

# add title
plt.suptitle('Wind speed and direction')

# set size of the figure (inches)
nmap.fig.set_figheight(7)
nmap.fig.set_figwidth(10)

# save figure to a PNG file
nmap.save('usecase2a.png')

Exercise:

Create a wind map for your area of interest for 1 Jan 2015


In [ ]: